<?php echo $html->script('jquery-1.4.2.min.js') ?>
<?php echo $html->script('dibai.js') ?>
<div class='left'>
<div id="user-head">
    <div class='avatar'>
        <?php echo $avatar->userLink($user['User']) ?>
    </div>
    <div class="user-info">
        <h2 class="user-link"><?php echo $linker->userLink($user['User']) ?></h2>
        <ul class="links">
         <li><?php echo $linker->wordsLink($user['User'],'单词') ?></li>
         <li><?php echo $linker->notesLink($user['User'],'日记') ?></li>
         <li>留言本</li>   
        </ul>
    </div>
    <div class="clear"></div>
</div>

<div id="note">
<div class="titles"><?php __('我的日记');?><span class="right-link"><?php echo $linker->notesLink($user['User'],'查看全部') ?></span></div>
<?php	foreach ($notes as $note):	?>
<div class="titled-content">
<div class="sub-titles"><?php echo $linker->noteLink($note['Note']); ?></div>
<div class="time"><?php echo $note['Note']['updated']; ?></div>

<div class="contents"><?php echo $formater->text($note['Note']['body']); ?></div>
<?php if ($own): ?>
<div class="actions">
<?php echo $html->link('修改', '/notes/edit/'.$note['Note']['id']) ?>
<?php echo $html->link('删除', '/notes/delete/'.$note['Note']['id']) ?>
</div>				
<?php endif ?>
</div>
<?php endforeach; ?>
</div>
<div id="words">
<div class="titles"><?php __('我的单词');?><span class="right-link"><?php echo $linker->wordsLink($user['User'],'查看全部') ?></span></div>
<?php if ($own): ?>

<?php echo $this->Form->create('Word',array('div' => false,'url'=>'','id'=>'submitWordForm','onSubmit'=>'return addWord(this);')); ?>
单词：<?php echo $this->Form->text('word',array('div' => false,'size'=>10)); ?>
解释：<?php echo $this->Form->text('description',array('div' => false,'size'=>30));?>	
<?php echo $this->Form->hidden('user_id',array('div' => false,'value'=>$cuid)); ?>	
<?php echo $this->Form->input('language_id',array('div' => false,'label'=>'语言：')); ?>
<?php echo $this->Form->end(array('label'=>'添加','div' => false)); ?>
<?php endif ?>


<ul id="word-list">  
<?php foreach ($words as $word): ?>
<li><span class="word"><?php echo $word['Word']['word'] ?></span>:<span class="desc"> <?php echo $word['Word']['description'] ?></span><span class="lan">[<?php echo $word['Language']['name'] ?>]</span></li>
<?php endforeach ?>
</ul>

</div>

</div>

<div class="right" >
<div id="profile">
<div class="userAvatar">
<?php echo $this->Avatar->userAvatar($user['User'],'m'); ?>
</div>
<p>昵称：<?php echo $user['User']['username']; ?></p>
<p>uid  ：<?php echo $user['User']['uid']; ?></p>
<p>注册：<?php echo $time->format( $format = 'Y-d-m',$user['User']['created']); ?></p>
<?php foreach ($lans as $lan): ?>
    <p><?php echo $html->link($lan['Language']['name'],"/languages/view/{$lan['Language']['id']}") ?>:<?php echo $lan['Level']['name'] ?></p>
<?php endforeach ?>
<div class="clear"></div>
<p class="desc">
<?php if (!$own): ?>
<?php echo $html->link('发站内消息', "/messages/add/{$user['User']['id']}",array('class'=>'btn')) ?>
<?php if (empty($is_followed)): ?>
<?php echo $html->link('加关注', "/followships/add/{$uid}", array('class'=>'btn')) ?>
<?php else: ?>
<?php echo $html->link('取消关注', "/followships/delete/{$uid}", array('class'=>'btn')) ?>
<?php endif ?>
<?php endif ?>
</p>
<div style="height: 0pt; border-bottom: 1px solid #cccccc; margin: 5px;"></div>
<p class="desc"><?php echo $formater->text($user['User']['description']) ?></p>


</div>
<div id="friends">
<div class="titles">关注<span class="right-link">关注（<?php echo $paginator->counter(array('format'=>'%count%')); ?>）人 / 被(<?php echo $followers_count ?>)人关注</span></div>
<?php foreach ($followings as $user): ?>
<dl class="avatars">
<dt>
<?php echo $this->Avatar->userLink($user['User']) ?>
</dt>
<dd> <?php echo $linker->userLink($user['User']) ?>
</dl>
<?php endforeach ?>	
<div class="clear"></div>
</div>
<div id="guest">
<div class="titles"><?php __('留言本');?></div>
<div class="comment-form">
<?php echo $this->Form->create('Guest',array('url'=>'/guests/add'));?>

<?php
echo $form->hidden('user_id',array('value'=>$uid));
echo $form->hidden('sender_id',array('value'=>$cuid));
echo $form->textArea('body');
?>
<?php echo $this->Form->end(__('留言', true));?>
</div>

<?php foreach ($guests as $guest):?>

<div class="comment_entry">
    <p class="usr_avatar">
     <?php echo $this->Avatar->userLink($guest['Sender']) ?>   
    </p>
	<div class="info">
	    <span class="author">
	        <?php echo $linker->userLink($guest['Sender']) ?>
	    </span>
	    <span class="time"><?php echo $guest['Guest']['created'] ?></span>  
	    <span>
	        <?php if ($own): ?>
        <?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $guest['Guest']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $guest['Guest']['id'])); ?>
        
        <?php endif ?>
        </span>
    </div>
	<div class="content">
	    <div><?php echo $guest['Guest']['body'] ?></div>
    </div>
</div>    
<?php endforeach; ?>
</div>
</div>
